package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.sky.result.Result;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id统计套餐菜品关系数据
     *
     * @param id
     * @return
     */
    @Select("select count(*) from setmeal_dish where dish_id=#{dishId}")
    Integer countByDishId(Long id);

    /**
     * 批量插入套餐菜品关系数据
     *
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 根据套餐id删除套餐和菜品关联的表中的数据
     *
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);


}
